<template>
  <div class="ptjkd-div">
    <div class="header">
      <span class="title">{{ dataObject.tagName }}</span>
      <span class="close" @click="emit('close')"></span>
    </div>
    <img
      class="loveImg"
      v-if="!props.info.clused"
      @click="changeClused('1')"
      src="/images/new/tag/love.png"
    />
    <img
      class="loveImg"
      @click="changeClused('0')"
      v-else
      src="/images/new/tag/loved.png"
    />
    <div class="content-info">
      <el-tabs v-model="videoTab">
        <el-tab-pane label="实时视频" name="实时视频">
          <div class="video-box">
            <onem ref="videoref" :vid="dataObject.tempDeviceId" />
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script setup>
import mapBox from "./map.vue";
import lineEcharts from "./line.vue";
const emit = defineEmits(["close", "changeClose"]);
const props = defineProps({
  info: Object,
  isd: {
    default: false,
    type: Boolean,
  },
});

const changeClused = (clused) => {
  emit("changeClose", clused);
};

let currentTab = ref("2");
const changTab = (tab) => {
  currentTab.value = tab;
};

let videoTab = ref("实时视频");
let videoref = ref();

let contentTab = ref("ryzpjl");

let optionsData = ref();

let lylist = ref([
  { value: "1", label: "来源1" },
  { value: "2", label: "来源2" },
  { value: "3", label: "来源3" },
]);

let ztlist = ref([
  { value: "1", label: "状态1" },
  { value: "2", label: "状态2" },
  { value: "3", label: "状态3" },
]);
let search = ref({
  ly: "",
  zt: "",
});

watch(videoTab, () => {
  if (videoref.value) {
    videoref.value.resize();
  }
});

watch(currentTab, () => {
  if (currentTab.value == "3") {
    optionsData.value = {
      xAxis: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
      in: [120, 132, 101, 134, 90, 230, 210],
      out: [132, 332, 301, 334, 190, 330, 310],
    };
  }
});
let dataObject = ref({});
const getData = () => {
  useApi
    .post("/dynamicview/ar/tagDetail", { tagId: props.info.tagId })
    .then((res) => {
      dataObject.value = res.data.tagInfo;
      // state.pm = res.data.tagInfo
      // state.data1 = res.data.faceStats
      // state.data2 = res.data.vehicleStats
      // state.data3 = res.data.tempCapture
      // if (state.pm.templateId == 'TCC') {
      //   getEvent()
      //   getEvent4()
      // }
      // if (state.pm.templateId == 'CBTKQ') {
      //   getEvent1()
      // }
      // if (state.pm.templateId == 'JYXF') {
      //   getEvent2()
      // }
      // if (state.pm.templateId == 'BGQ') {
      //   getEvent3()
      // }
      // if (state.pm.templateId == 'CBTKQ' || state.pm.templateId == 'JMQ') {
      //   setTimeout(() => {
      //     state.pm.templateId == 'CBTKQ' ? chart3() : chart4()
      //   }, 1000);
      // }
    });
};

watch(
  () => props.info,
  (newval) => {
    if (newval.tagId) {
      getData();
    }
  },
  {
    deep: true,
    immediate: true,
  }
);

onMounted(() => {});
</script>

<style lang="scss">
.ptjkd-div {
  width: 503px;
  min-height: 434px;
  background: url("/images/new/tag/tagbg.png") no-repeat;
  background-size: 100% 100%;
  position: relative;
  padding-bottom: 30px;
  .loveImg {
    width: 40px;
    height: 40px;
    position: absolute;
    right: 40px;
    top: 75px;
    cursor: pointer;
    z-index: 999;
  }
  .header {
    width: 100%;
    height: 52.5px;
    position: relative;
    background: url("/images/new/tag/header.png") no-repeat;
    background-size: 100% 100%;
    .title {
      display: inline-block;
      height: 100%;
      padding-left: 25px;
      font-family: YouSheBiaoTiHei;
      font-size: 25px;
      color: #ffffff;
      line-height: 60px;
    }

    .close {
      width: 40px;
      height: 40px;
      position: absolute;
      right: 16px;
      top: 20.5px;
      line-height: 40px;
      text-align: center;
      color: #fff;
      font-size: 30px;
      cursor: pointer;
    }
  }

  .content-info {
    margin-top: 20px;
    padding: 0 30px;
  }
}
</style>

<style lang="scss">
.ptjkd-div {
  .video-box {
    width: 440px;
    height: 247.5px;
  }
  .el-select__wrapper {
    background: #067cc0;
    span {
      color: #ffffff !important;
    }
  }
  .el-tabs__item {
    font-family: YouSheBiaoTiHei;
    font-size: 21px;
    color: #ffffff;
    line-height: 29px;
    text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
    &.is-active {
    }
  }
  .el-tabs__nav-wrap:after {
    background: none;
  }
  .el-tabs__active-bar {
    background: #18e1ff;
  }
  .header-box {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .header-name {
      font-family: YouSheBiaoTiHei;
      font-size: 21px;
      color: #ffffff;
    }
  }
}
</style>